<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>内容详情</title>
    <style>
        #container {
            width: 80%;
            margin: 10px auto;
        }
        .teacher {
            width: 100%;
            margin: 0 auto;
            padding: 10px 0;
            border-bottom: 1px dashed gray;
            overflow: auto;
        }
        .teacher div {
            float: left;
        }
        .photo {
            height: 140px;
            border-radius: 75px;
            overflow: hidden;
            margin-left: 20px;
        }
        .info {
            width: 75%;
            margin-left: 30px;
        }
        .info div {
            clear: both;
            margin: 5px 10px;
        }
        .info span {
            margin-right: 25px;
        }
        .info a {
            text-decoration: none;
            color: darkcyan;
        }
        .user {
            float: right;
            margin: 10px 10px;
        }
        .user+h1 {
            clear: both;
        }
        #photo {
            border-radius: 32px 32px 32px 32px;
        }
    </style>
</head>
<body>
    <div id="container">
        <h1>{{ post.title }}帖子评论信息</h1>
        <hr>
        <div class="teacher" v-for="comment in comments">

            <div class="info">
                <div>
                    <h3>{{ post.title }}</h3>
                    <p>{{ post.content }}</p>
                    <p>评论：{{ comment.content  }}</p>
                </div>

            </div>
        </div>
        <a href="/">返回首页</a>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.min.js"></script>
    <script>
        let app = new Vue({
            el: '#container',
            data:{
                post:{},
                comments: []
            },

            created: function () {
                fetch('/comments/' + location.search)
                    .then(resp => resp.json())
                    .then(json => {
                        this.post = json.post
                        this.comments = json.comments
                    })
            }
        })
    </script>
</body>
</html>